#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <iostream>
#include <opencv.hpp>//opencv头文件
#include <opencv2/opencv.hpp>
#include <opencv2/face.hpp>
#include <QImage>
#include <QPixmap>
#include <QDebug>

using namespace std;
using namespace cv;//opencv命名空间
using namespace cv::face;

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

struct Person
{
    QString name;
    int x,y;

};

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QString subject,int num,QWidget *parent = nullptr);
    ~MainWindow();
    void initSeats();
    void initOpencv();
    void timerEvent(QTimerEvent *e);
    void showFace();
    void findFace();
    void randSeat(QString name,int id);//随机分配一个座位

private slots:
    void on_pushButton_choose_clicked();

    void on_pushButton_exit_clicked();

    void on_pushButton_output_clicked();

private:
    Ui::MainWindow *ui;
    int seatNum;//接受考试人数
    CascadeClassifier cc;
    Mat frame;
    Ptr<FaceRecognizer> faceRecognizer;
    VideoCapture vc;
    vector<Rect> faces;
    map<int,Person> person;

};
#endif // MAINWINDOW_H
